package com.xiao.train.member.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RefreshScope
public class TestController {

    @Value("${test.nacos}")
    private String val;

    @Autowired
    Environment environment;

    @GetMapping("hello")
    public String hello() {
        log.info("test.nacos: {}", val);
        return String.format("val:%s port:%s", val, environment.getProperty("local.server.port"));
    }
}
